package com.flyco.modules.pms.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.flyco.modules.pms.entity.PmsProductPriceRegulate;
import com.flyco.modules.pms.mapper.PmsProductPriceRegulateMapper;
import com.flyco.modules.pms.service.IPmsProductPriceRegulateService;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
 * @Description: 商品价格管控
 * @Author: flyco
 * @Date:   2020-02-26
 * @Version: V1.0
 */
@Service
public class PmsProductPriceRegulateServiceImpl extends ServiceImpl<PmsProductPriceRegulateMapper, PmsProductPriceRegulate> implements IPmsProductPriceRegulateService {

    @Override
    public PmsProductPriceRegulate getByProductSn(String productSn) {
        LambdaQueryWrapper<PmsProductPriceRegulate> regulateQueryWrapper = new LambdaQueryWrapper<>();
        regulateQueryWrapper.eq(PmsProductPriceRegulate::getProductSn,productSn);
        return this.getOne(regulateQueryWrapper, false);
    }

    @Override
    public PmsProductPriceRegulate getBySkuCode(String skuCode) {
        LambdaQueryWrapper<PmsProductPriceRegulate> regulateQueryWrapper = new LambdaQueryWrapper<>();
        regulateQueryWrapper.eq(PmsProductPriceRegulate::getSkuCode, skuCode);
        return this.getOne(regulateQueryWrapper, false);
    }
}
